import { Column, Entity } from 'typeorm';
import { BaseEntity } from './baseEntity';

@Entity()
export class TMenu extends BaseEntity {
  @Column({
    type: 'int',
    name: 'pid',
    comment: '父级路由id',
    nullable: true,
  })
  pid: number;

  @Column({
    type: 'varchar',
    name: 'name',
    comment: '路由名称(命名路由，用于添加嵌套路由)',
  })
  name: string;

  @Column({
    type: 'varchar',
    name: 'path',
    comment: '路由路径(浏览器显示的路径)',
  })
  path: string;

  @Column({
    type: 'varchar',
    name: 'component',
    comment: '组件路径(匹配前端的/src/views文件夹)',
  })
  component: string;

  @Column({ type: 'varchar', name: 'permission', comment: '权限字符，可多选' })
  permission: string;

  @Column({
    type: 'int',
    name: 'is_sidebar',
    comment: '是否为侧边栏(1代表为侧边栏，0代表不为侧边栏)',
  })
  isSidebar: number;

  @Column({ type: 'json', name: 'meta', comment: '元数据' })
  meta: JSON | null;
}
